<?php

namespace Ecom\ProdutosBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Ecom\ProdutosBundle\Entity\Atributo
 *
 * @ORM\Table(name="ecom_produto_atributo")
 * @ORM\Entity
 */
class Atributo
{
    /**
     * @var integer $id
     *
     * @ORM\Column(name="id", type="integer", nullable=false)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $id;

    /**
     * @var string $nome
     *
     * @ORM\Column(name="nome", type="string", length=255, nullable=false, unique=true)
     */
    private $nome;

    /**
     * @var text $descricao
     *
     * @ORM\Column(name="descricao", type="text", nullable=true)
     */
    private $descricao;

    /**
     * @var ModeloAtr
     *
     * @ORM\ManyToMany(targetEntity="ModeloAtr", mappedBy="atributo")
     */
    private $modeloatr;

    public function __construct()
    {
        $this->modeloatr = new \Doctrine\Common\Collections\ArrayCollection();
    }
    
    /**
     * Método necessário para listas em outros CRUD
     * 
     * @return string
     */
    public function __toString() {
        return $this->getNome();
    }

    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set nome
     *
     * @param string $nome
     */
    public function setNome($nome)
    {
        $this->nome = $nome;
    }

    /**
     * Get nome
     *
     * @return string 
     */
    public function getNome()
    {
        return $this->nome;
    }

    /**
     * Set descricao
     *
     * @param text $descricao
     */
    public function setDescricao($descricao)
    {
        $this->descricao = $descricao;
    }

    /**
     * Get descricao
     *
     * @return text 
     */
    public function getDescricao()
    {
        return $this->descricao;
    }

    /**
     * Add modeloatr
     *
     * @param Ecom\ProdutosBundle\Entity\ModeloAtr $modeloatr
     */
    public function addModeloAtr(\Ecom\ProdutosBundle\Entity\ModeloAtr $modeloatr)
    {
        $this->modeloatr[] = $modeloatr;
    }

    /**
     * Set modeloatr
     * 
     * @return ModeloAtr $modeloatr
     */
    public function setModeloAtr() {
        return $this->modeloatr;
    }

    /**
     * Get modeloatr
     *
     * @return Doctrine\Common\Collections\Collection 
     */
    public function getModeloatr()
    {
        return $this->modeloatr;
    }
}